/**
 * @Project Name:sso-demo
 * @Package Name:cn.hoofungson.ssodemo.clientcredentials.controller
 * @Since JDK 1.8
 */
package cn.hoofungson.ssodemo.clientcredentials.controller;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 测试控制器
 * @Author 胡松 hoofungson@163.com
 * @Date 2017-10-19 14:52
 * @Version V1.0
 */
@RestController
public class TestEndpointsController {

    @GetMapping(value = "/product/{id}")
    public String getProduct(@PathVariable String id){
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        return "product id : " + id;
    }

    @GetMapping(value = "/order/{id}")
    public String getOrder(@PathVariable String id) {
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        return "order id : " + id;
    }
}
